<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>博客后台管理 - 发布文章</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../static/css/font.css">
    <link rel="stylesheet" href="../../static/css/weadmin.css">
</head>

<body>
    <div class="weadmin-body">
        <form class="layui-form" style="width: 700px;">
            <div class="layui-form-item">
                <label class="layui-form-label">文章标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">文章内容</label>
                <div class="layui-input-block">
                    <textarea name="content" lay-verify="required" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">标签</label>
                <div class="layui-input-block">
                    <select name="tagId" id="tag" lay-verify="required">
                        <option value="">请选择</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="add">发布</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>

        <script src="../../lib/layui/layui.js" charset="utf-8"></script>
        <script src="add-article.js" type="text/javascript"></script>
        <script>
            function setdata(data) {
                //渲染表单
                layui.use(['form', 'jquery'], function () {
                    var $ = layui.jquery;

                    for (var i = 0; i < data.length; i++) {
                        $("#tag").append("<option value=\"" + data[i].id + "\">" + data[i].title + "</option>");
                    }
                    //重新渲染
                    layui.form.render("select");
                });
            }
        </script>
    </div>
</body>
</html>